package com.gxy.learn.design.model.create.singleton;

import lombok.extern.slf4j.Slf4j;

/**
 * @description: 单例测试类
 * @author: gaoxueyong
 * @Date: 2022/11/6 16:57
 */
@Slf4j
public class Client {
    public static void main(String[] args) {
        SingletonHungryStaticParam instanceOld = SingletonHungryStaticParam.getInstance();
        SingletonHungryStaticParam instanceNew = SingletonHungryStaticParam.getInstance();
//        == 比较内存中地址是否一样  equals 比较值是否一致
        log.info("instanceOld == instanceNew : {}", instanceNew == instanceNew);
        log.info("instanceNew.equals(instanceNew): {}", instanceNew.equals(instanceNew));

        SingletonHungryStaticCode hungryStaticCodeOld = SingletonHungryStaticCode.getInstance();
        SingletonHungryStaticCode hungryStaticCodeNew = SingletonHungryStaticCode.getInstance();
        log.info("hungryStaticCodeOld == hungryStaticCodeNew : {}", hungryStaticCodeOld == hungryStaticCodeNew);
        log.info("hungryStaticCodeOld.equals(hungryStaticCodeNew): {}", hungryStaticCodeOld.equals(hungryStaticCodeNew));


        SingletonSluggard singletonSluggardOld = SingletonSluggard.getInstance();
        SingletonSluggard singletonSluggardNew = SingletonSluggard.getInstance();
        log.info("singletonSluggardOld == singletonSluggardNew : {}", singletonSluggardOld == singletonSluggardNew);
        log.info("singletonSluggardOld.equals(singletonSluggardNew): {}", singletonSluggardOld.equals(singletonSluggardNew));

        SingletonSluggardDcl singletonSluggardDclOld = SingletonSluggardDcl.getInstance();
        SingletonSluggardDcl singletonSluggardDclNew = SingletonSluggardDcl.getInstance();
        log.info("singletonSluggardDclOld == singletonSluggardDclNew : {}", singletonSluggardDclOld == singletonSluggardDclNew);
        log.info("singletonSluggardDclOld.equals(singletonSluggardDclNew): {}", singletonSluggardDclOld.equals(singletonSluggardDclNew));

        SingletonSluggardStatic singletonSluggardStaticOld = SingletonSluggardStatic.getInstance();
        SingletonSluggardStatic singletonSluggardStaticNew = SingletonSluggardStatic.getInstance();
        log.info("singletonSluggardStaticOld == singletonSluggardStaticNew : {}", singletonSluggardStaticOld == singletonSluggardStaticNew);
        log.info("singletonSluggardStaticOld.equals(singletonSluggardStaticNew): {}", singletonSluggardStaticOld.equals(singletonSluggardStaticNew));



    }
}
